package com.niit.mobileDevide.age;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class AgeBean implements Writable {

    private String deviceModel;
    private int count;

    public AgeBean() {}

    public AgeBean(String deviceModel, int count) {
        this.deviceModel = deviceModel;
        this.count = count;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(deviceModel);
        out.writeInt(count);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        deviceModel = in.readUTF();
        count = in.readInt();
    }

    public String getDeviceModel() {
        return deviceModel;
    }

    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return String.format("%s,%d", deviceModel, count);
    }
}